From 2700fa96e938e3c10d23380c5ab6176471a98872 Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Tue, 11 Mar 2003 12:11:03 +0000 Subject: [PATCH] bitkeeper revision 1.122.1.1 (3e6dd2571tuS-UOLoEX2Z4iIxMPlxA) pci.h, perfc.c: Fixed PCI DMA code -- a fake virtual address of NULL is actually valid. --- BitKeeper/etc/logging_ok | 1 + xen/common/perfc.c | 2 ++ xen/include/asm-i386/pci.h | 12 ++++++------ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index cc166e6358..4998459b72 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -6,6 +6,7 @@ bd240@boulderdash.cl.cam.ac.uk iap10@labyrinth.cl.cam.ac.uk kaf24@labyrinth.cl.cam.ac.uk kaf24@plym.cl.cam.ac.uk +kaf24@scramble.cl.cam.ac.uk kaf24@striker.cl.cam.ac.uk lynx@idefix.cl.cam.ac.uk rn@wyvis.camb.intel-research.net diff --git a/xen/common/perfc.c b/xen/common/perfc.c index 55554eba70..6b7e9f2af3 100644 --- a/xen/common/perfc.c +++ b/xen/common/perfc.c @@ -5,6 +5,8 @@ #include #include +#undef PERFCOUNTER +#undef PERFCOUNTER_ARRAY #define PERFCOUNTER( var, name ) "[0]"name"\0", #define PERFCOUNTER_ARRAY( var, name, size ) "["#size"]"name"\0", diff --git a/xen/include/asm-i386/pci.h b/xen/include/asm-i386/pci.h index 1ffade8914..a38bef4986 100644 --- a/xen/include/asm-i386/pci.h +++ b/xen/include/asm-i386/pci.h @@ -151,17 +151,17 @@ static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, for (i = 0; i < nents; i++ ) { if (sg[i].address && sg[i].page) out_of_line_bug(); - - /* not worth checking since NULL is ok says SMH */ #if 0 - else if (!sg[i].address && !sg[i].page) + /* Invalid check, since address==0 is valid. */ + else if (!sg[i].address && !sg[i].page) out_of_line_bug(); #endif - if (sg[i].address) - sg[i].dma_address = virt_to_bus(sg[i].address); - else + /* XXX Switched round, since address==0 is valid. */ + if (sg[i].page) sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset; + else + sg[i].dma_address = virt_to_bus(sg[i].address); } flush_write_buffers(); -- 2.30.2